|
The GNU Coding Standards are a set of rules and guidelines for writing programs that work consistently within the GNU system. The GNU Coding Standards were written by Richard Stallman and other GNU Project volunteers. The standards document is part of the GNU Project and is available from the GNU website (). Though it focuses on writing free software for GNU in C, much of it can be applied more generally. In particular, the GNU Project encourages its contributors to always try to follow the standards—whether or not their programs are implemented in C. The C code formatting style is well-known within the free software community, but of course, anyone can choose to follow it. ==Code formatting== The GNU Coding Standards specify exactly how to format most C programming language constructs. Here is a characteristic example: int main (int argc, char *argv[]) while (foo.bar >= GIZMO_SNUFKIN_THRESHOLD); store_size (wilma); goto check; } return 0; } The consistent treatment of blocks as statements (for the purpose of indentation) is a very distinctive feature of the GNU C code formatting style; as is the mandatory space before parentheses. All code formatted in the GNU style has the property that each closing brace, bracket or parenthesis appears ''to the right'' of its corresponding opening delimiter, or in the same column. As a general principle, GNU Emacs can be considered a reliable authority on the GNU code formatting style. As such, it is desirable that any piece of code that looks ugly when indented by Emacs is changed into a more Emacs-friendly form—for example, by inserting additional parentheses. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「GNU coding standards」の詳細全文を読む スポンサード リンク
|